/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Administrator
 */
import javax.servlet.*;
import java.sql.*;
public class MusicApplicationListener implements ServletContextListener{
    Connection conn;
    public void contextInitialized(ServletContextEvent event)
    {
        ServletContext application = event.getServletContext();
        
        DBConnector dbcon = new DBConnector();
        this.conn = dbcon.getConn();
        application.setAttribute("Labb3", this.conn);
    }
    public void contextDestroyed(ServletContextEvent event)
    {
        try{
        conn.close();
        }
        catch(SQLException e)
        {
            System.out.println("fel: " + e);
        }
    }

}
